package cn.livingCloud.dto;

import cn.livingCloud.entity.core.PushGroup;
import cn.livingCloud.utils.DateUtils;
import org.apache.commons.lang.StringUtils;

/**
 * Created by DingJie on 2016/6/21.
 */
public class PushGroupDto {
    private String uuid;
    private String name;
    private String reportRuleUuid;
    private String cronExpression;
    private String createDateTime;
    private Boolean archive;
    private boolean state;
    private ReportRuleDto reportRuleDto;

    public PushGroupDto() {
    }

    public PushGroupDto(PushGroup item) {
        this.uuid = item.getUuid();
        this.reportRuleUuid = item.getReportRuleUuid();
        this.name = item.getName();
        this.createDateTime = DateUtils.toDateText(item.getCreateDateTime()
                , DateUtils.DEFAULT_DATE_TIME_FORMAT);
        this.archive = item.getArchive();
        this.state = item.isState();
        this.cronExpression = item.getCronExpression();
        if (StringUtils.isNotEmpty(reportRuleUuid)) {
            this.reportRuleDto = new ReportRuleDto(item.getReportRule());
        }
    }

    public Boolean getArchive() {
        return archive;
    }

    public void setArchive(Boolean archive) {
        this.archive = archive;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCreateDateTime() {
        return createDateTime;
    }

    public void setCreateDateTime(String createDateTime) {
        this.createDateTime = createDateTime;
    }

    public String getCronExpression() {
        return cronExpression;
    }

    public PushGroupDto setCronExpression(String cronExpression) {
        this.cronExpression = cronExpression;
        return this;
    }

    public String getReportRuleUuid() {
        return reportRuleUuid;
    }

    public void setReportRuleUuid(String reportRuleUuid) {
        this.reportRuleUuid = reportRuleUuid;
    }

    public ReportRuleDto getReportRuleDto() {
        return reportRuleDto;
    }

    public void setReportRuleDto(ReportRuleDto reportRuleDto) {
        this.reportRuleDto = reportRuleDto;
    }

    public boolean isState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }
}
